import { createSlice } from '@reduxjs/toolkit'

export const userSlice = createSlice({
  name: 'user',
  initialState: {
    userInfo:{},
    token:""
  },
  reducers: {
   loginsuccess(state,action){
    state.userInfo=action.payload.userInfo
    state.token=action.payload.token
   }
  },
})

// Action creators are generated for each case reducer function
export const { loginsuccess } = userSlice.actions